<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class File extends Model
{
    public static function get_list($type = '')
    {
       ;
        if ($type != '') {
            $return = self::with('info') ->where('type', $type)->orderBy('create_at','desc');
        }else{
            $return = self::with('info')->orderBy('create_at','desc');
        }
        return $return;
    }

    public function info()
    {
        return $this->hasMany('App\FileInfo', 'files_id', 'id');
    }
}
